package com.shenqi.language.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.shenqi.language.mapper.UserbookMapper;
import com.shenqi.language.domain.Userbook;
import com.shenqi.language.service.IUserbookService;

/**
 * 用户生词本Service业务层处理
 * 
 * @author shenqi
 * @date 2025-08-05
 */
@Service
public class UserbookServiceImpl implements IUserbookService 
{
    @Autowired
    private UserbookMapper userbookMapper;

    /**
     * 查询用户生词本
     * 
     * @param id 用户生词本主键
     * @return 用户生词本
     */
    @Override
    public Userbook selectUserbookById(Long id)
    {
        return userbookMapper.selectUserbookById(id);
    }

    /**
     * 查询用户生词本列表
     * 
     * @param userbook 用户生词本
     * @return 用户生词本
     */
    @Override
    public List<Userbook> selectUserbookList(Userbook userbook)
    {
        return userbookMapper.selectUserbookList(userbook);
    }

    /**
     * 新增用户生词本
     * 
     * @param userbook 用户生词本
     * @return 结果
     */
    @Override
    public int insertUserbook(Userbook userbook)
    {
        userbook.setCreateTime(DateUtils.getNowDate());
        return userbookMapper.insertUserbook(userbook);
    }

    /**
     * 修改用户生词本
     * 
     * @param userbook 用户生词本
     * @return 结果
     */
    @Override
    public int updateUserbook(Userbook userbook)
    {
        userbook.setUpdateTime(DateUtils.getNowDate());
        return userbookMapper.updateUserbook(userbook);
    }

    /**
     * 批量删除用户生词本
     * 
     * @param ids 需要删除的用户生词本主键
     * @return 结果
     */
    @Override
    public int deleteUserbookByIds(Long[] ids)
    {
        return userbookMapper.deleteUserbookByIds(ids);
    }

    /**
     * 删除用户生词本信息
     * 
     * @param id 用户生词本主键
     * @return 结果
     */
    @Override
    public int deleteUserbookById(Long id)
    {
        return userbookMapper.deleteUserbookById(id);
    }
}
